﻿/*
 * @Autor: PK
 * @Date: 2022/01/04 20:38:SS
 */

using System;
using System.IO;

namespace ShkSimulation.desktop.component.tools {

	public class WinformConsoleTextWriter: TextWriter {

		public WinformConsoleTextBox consoleTextBox { get; set; }

		public static WinformConsoleTextWriter Instance { get; set; } = new WinformConsoleTextWriter();

		public override void Write(char value) {
			OutputDataReceived?.Invoke(value);
			base.Write(value);
		}

		public override System.Text.Encoding Encoding {
			get { return System.Text.Encoding.UTF8; }
		}

		public event Action<char> OutputDataReceived;

	}

}